package com.ruoyi.project.system.controller;

import com.ruoyi.framework.aspectj.lang.annotation.Anonymous;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.ReservationStatsDTO;
import com.ruoyi.project.system.service.IReservationStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 预约统计接口（适配前端 /dev-api/system/reservation/stats）
 */
@RestController
@RequestMapping("/system/reservation")
public class ReservationStatsController extends BaseController {

    @Autowired
    private IReservationStatsService reservationStatsService;

    /**
     * 获取预约统计数据（一级科室汇总 + 总剩余名额）
     */
    
    @Anonymous
    @GetMapping("/stats")
    public AjaxResult getReservationStats() {
        ReservationStatsDTO stats = reservationStatsService.getReservationStats();
        // 按 RuoYi 标准格式返回（code=200，data=统计结果）
        return AjaxResult.success(stats);
    }
}
